﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.UI.WebControls;
using Medianamik.UI.Web.MVP;
using Medianamik.UI.Web.MVP.View;

namespace Medianamik.UI.Web.Approbation
{
    public partial class ApprobationList : ModuleViewWithGrid<IApprobationList>, IApprobationList
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            FilterButton.Click += OnFilterButton;
        }

        void OnFilterButton(object sender, EventArgs e)
        {
            OnFilter();
        }

        public override bool EnableDelete
        {
            get { return false; }
        }

        public override IMedianamikGrid Grid
        {
            get { return (IMedianamikGrid)ApprobationGrid; }
        }

        public override string ListingPageUrl
        {
            get { return Pages.ApprobationList; }
        }

        public override string EditPageUrl
        {
            get { return Core.Pages.ContentManagementEdition; }
        }

        public override string BreadcrumbTrail
        {
            get { return Breadcrumbs.Text; }
            set { Breadcrumbs.Text = value; }
        }

        public override Guid ModuleNodeId
        {
            get { return Modules.Approbation; }
        }

        public bool IsPublishing
        {
            get { return false; }
        }

        public IEnumerable<ListItem> ExactApprobationLevel
        {
            get { return ExactApprobationLevelList.Items.Cast<ListItem>(); }
            set { ExactApprobationLevelList.Items.AddRange(value.ToArray()); }
        }
    }

    public interface IApprobationList : IModuleViewWithGrid
    {
        bool IsPublishing { get; }
        IEnumerable<ListItem> ExactApprobationLevel { get; set; }
    }
}
